package com.factory.model;

import com.factory.model.entity.Apple;
import com.factory.model.entity.Banana;
import com.factory.model.entity.Fruits;
import com.factory.model.entity.Pear;
import com.factory.model.factory.AbstractFruitsFactory;
import com.factory.model.factory.FruitsFactory;

public class FactoryModelTestMain {
    public static void main(String[] args) {
        //声明工厂
        AbstractFruitsFactory factory = new FruitsFactory();
        Fruits apple =  factory.createFruitJuice(Apple.class);
        System.out.println("我有苹果，先来个苹果汁");
        apple.getColor();
        apple.getTaste();
        Fruits banana = factory.createFruitJuice(Banana.class);
        System.out.println("我还有香蕉，再来个香蕉汁");
        banana.getColor();
        banana.getTaste();
        Fruits pear =factory.createFruitJuice(Pear.class);
        System.out.println("我还有雪梨，再来个雪梨汁");
        pear.getColor();
        pear.getTaste();
    }
}
